package com.expdatacloud.config;

import com.expdatacloud.interceptor.MyInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * 定义资源映射器
 * @author jie
 * @date 2019/6/4 -17:06
 */
@Configuration
public class WebMvcConfig implements WebMvcConfigurer {
    @Override
    public void addInterceptors(InterceptorRegistry registry) {

        registry.addInterceptor(new MyInterceptor())
                .excludePathPatterns("/iqc/iqcManager","/restart")
                .addPathPatterns("/inspectionPlanMgt/**","/iqcCheckItemDetails/**",
                        "/iqcDetection/**","/iqcDetectionDetail/**","/iqcSamplingShow/**");
    }

    @Override
    public void addViewControllers(ViewControllerRegistry registry) {
        registry.addViewController("/history/iqcHistory").setViewName("/history/iqcHistory");
        registry.addViewController("/restart").setViewName("/restart");
        registry.addViewController("/report/receivingReconciliation").setViewName("/report/receivingReconciliation");
        registry.addViewController("/report/iqcHistoryReconciliation").setViewName("/report/iqcHistoryReconciliation");
        registry.addViewController("/report/iqc/inspectionMonthlyReport").setViewName("/report/iqc/inspectionMonthReport");
        registry.addViewController("/report/iqc/chart/inspectionWeekChart").setViewName("/report/iqc/chart/inspectionWeekChart");
        registry.addViewController("/report/iqc/chart/inspectionMonthChart").setViewName("/report/iqc/chart/inspectionMonthChart");
        registry.addViewController("/store/overdueMaterialSummary").setViewName("/store/overdueMaterialSummary");
        registry.addViewController("/test/expLayui").setViewName("/test/expLayui");
        registry.addViewController("/test/test01").setViewName("/test/test01");
        //registry.addViewController("/itrn/binItrn").setViewName("/itrn/binItrn");
        registry.addViewController("/test/tableEdit").setViewName("/test/tableEdit");
    }
}
